; ModuleID = '/Users/aserlili/Documents/Codes/llvm-build/test/OllvmTest/calculate.cpp'
source_filename = "/Users/aserlili/Documents/Codes/llvm-build/test/OllvmTest/calculate.cpp"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "arm64-apple-macosx15.0.0"

%struct.StructTest = type { i32, ptr }

@dec0.str = private global [31 x i8] zeroinitializer, align 1
@dec_status_0.str = private global i32 0
@dec1.str.1 = private global [20 x i8] zeroinitializer, align 1
@dec_status_1.str.1 = private global i32 0
@dec__ZL11struct_test = private global %struct.StructTest zeroinitializer, align 8
@dec_status__ZL11struct_test = private global i32 0
@EncryptedStringTable = private global [140 x i8] c"\937\D4@\C9\CB\AE\96\81R\819\CCd\92e\DCx\DFR-\02\FFbu\CCn\96@\826:\E9\B8\D4M\C6\BF8\C9t\B5)?\A4A;20'\1E2*\09=;~&\9D\B7-8q`\9Dn-md R\12wW\F5\B7\05H\9F\22\D0\06\F8\A2\0E\1D3Y\A2\0B\12\17~\F3p\9D4\E5f\E0:\D5tQn\C7\8C\DB\A74%\D8\D7\D2\84\DA;\F7>\17\8C\18\19\18'(,,&\F0\18Rl\FD\19P\9D\A8\82\F5"

; Function Attrs: mustprogress noinline optnone ssp uwtable(sync)
define noundef double @_Z9calculateddc(double noundef %a, double noundef %b, i8 noundef signext %op) #0 {
entry:
  %retval = alloca double, align 8
  %a.addr = alloca double, align 8
  %b.addr = alloca double, align 8
  %op.addr = alloca i8, align 1
  store double %a, ptr %a.addr, align 8
  store double %b, ptr %b.addr, align 8
  store i8 %op, ptr %op.addr, align 1
  %0 = load double, ptr %a.addr, align 8
  %1 = load double, ptr %b.addr, align 8
  %2 = load i8, ptr %op.addr, align 1
  %conv = sext i8 %2 to i32
  call void @goron_decrypt_string_0(ptr @dec0.str, ptr getelementptr inbounds ([140 x i8], ptr @EncryptedStringTable, i32 0, i32 26))
  %call = call i32 (ptr, ...) @printf(ptr noundef @dec0.str, double noundef %0, double noundef %1, i32 noundef %conv)
  %3 = load i8, ptr %op.addr, align 1
  %conv1 = sext i8 %3 to i32
  switch i32 %conv1, label %sw.default [
    i32 43, label %sw.bb
    i32 45, label %sw.bb2
    i32 42, label %sw.bb3
    i32 47, label %sw.bb4
  ]

sw.bb:                                            ; preds = %entry
  %4 = load double, ptr %a.addr, align 8
  %5 = load double, ptr %b.addr, align 8
  %add = fadd double %4, %5
  store double %add, ptr %retval, align 8
  br label %return

sw.bb2:                                           ; preds = %entry
  %6 = load double, ptr %a.addr, align 8
  %7 = load double, ptr %b.addr, align 8
  %sub = fsub double %6, %7
  store double %sub, ptr %retval, align 8
  br label %return

sw.bb3:                                           ; preds = %entry
  %8 = load double, ptr %a.addr, align 8
  %9 = load double, ptr %b.addr, align 8
  %mul = fmul double %8, %9
  store double %mul, ptr %retval, align 8
  br label %return

sw.bb4:                                           ; preds = %entry
  %10 = load double, ptr %b.addr, align 8
  %cmp = fcmp une double %10, 0.000000e+00
  br i1 %cmp, label %if.then, label %if.else

if.then:                                          ; preds = %sw.bb4
  %11 = load double, ptr %a.addr, align 8
  %12 = load double, ptr %b.addr, align 8
  %div = fdiv double %11, %12
  store double %div, ptr %retval, align 8
  br label %return

if.else:                                          ; preds = %sw.bb4
  store double -1.000000e+00, ptr %retval, align 8
  br label %return

sw.default:                                       ; preds = %entry
  store double -1.000000e+00, ptr %retval, align 8
  br label %return

return:                                           ; preds = %sw.default, %if.else, %if.then, %sw.bb3, %sw.bb2, %sw.bb
  %13 = load double, ptr %retval, align 8
  ret double %13
}

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: mustprogress noinline norecurse optnone ssp uwtable(sync)
define noundef i32 @main(i32 noundef %argc, ptr noundef %argv) #2 {
entry:
  %retval = alloca i32, align 4
  %argc.addr = alloca i32, align 4
  %argv.addr = alloca ptr, align 8
  store i32 0, ptr %retval, align 4
  store i32 %argc, ptr %argc.addr, align 4
  store ptr %argv, ptr %argv.addr, align 8
  call void @__global_variable_initializer__ZL11struct_test(ptr @dec__ZL11struct_test)
  %0 = getelementptr inbounds %struct.StructTest, ptr @dec__ZL11struct_test, i32 0, i32 1
  %1 = load ptr, ptr %0, align 8
  call void @goron_decrypt_string_1(ptr @dec1.str.1, ptr getelementptr inbounds ([140 x i8], ptr @EncryptedStringTable, i32 0, i32 99))
  %call = call i32 (ptr, ...) @printf(ptr noundef @dec1.str.1, ptr noundef %1)
  %call1 = call noundef double @_Z9calculateddc(double noundef 0.000000e+00, double noundef 0.000000e+00, i8 noundef signext 47)
  %call2 = call noundef double @_Z9calculateddc(double noundef 1.000000e+00, double noundef 2.000000e+00, i8 noundef signext 47)
  %call3 = call noundef double @_Z9calculateddc(double noundef 1.000000e+00, double noundef 2.000000e+00, i8 noundef signext 43)
  %call4 = call noundef double @_Z9calculateddc(double noundef 1.000000e+00, double noundef 2.000000e+00, i8 noundef signext 45)
  ret i32 0
}

define private void @goron_decrypt_string_0(ptr nocapture %plain_string, ptr nocapture %data) {
Enter:
  %0 = getelementptr inbounds i8, ptr %data, i32 18
  %1 = load i32, ptr @dec_status_0.str, align 4
  %2 = icmp eq i32 %1, 1
  br i1 %2, label %Exit, label %LoopBody.preheader

LoopBody.preheader:                               ; preds = %Enter
  br label %LoopBody

LoopBody:                                         ; preds = %LoopBody.preheader, %LoopEnd
  %3 = phi i32 [ %23, %LoopEnd ], [ 0, %LoopBody.preheader ]
  %4 = phi i8 [ %21, %LoopEnd ], [ 0, %LoopBody.preheader ]
  %5 = getelementptr inbounds i8, ptr %0, i32 %3
  %6 = load volatile i8, ptr %5, align 1
  %7 = urem i32 %3, 18
  %8 = getelementptr inbounds i8, ptr %data, i32 %7
  %9 = load i8, ptr %8, align 1
  %10 = zext nneg i8 %9 to i32
  %11 = mul nuw nsw i32 %7, %10
  %12 = and i32 %11, 1
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %LoopBr0, label %LoopBr1

LoopBr0:                                          ; preds = %LoopBody
  %14 = add i8 %6, %4
  %15 = xor i8 %14, %9
  %16 = xor i8 %15, -1
  br label %LoopEnd

LoopBr1:                                          ; preds = %LoopBody
  %17 = sub i8 %6, %4
  %18 = xor i8 %17, %9
  %19 = sub i8 0, %18
  br label %LoopEnd

LoopEnd:                                          ; preds = %LoopBr1, %LoopBr0
  %20 = phi i8 [ %16, %LoopBr0 ], [ %19, %LoopBr1 ]
  %21 = xor i8 %20, %9
  %22 = getelementptr inbounds i8, ptr %plain_string, i32 %3
  store i8 %21, ptr %22, align 1
  %23 = add nuw nsw i32 %3, 1
  %24 = icmp eq i32 %23, 31
  br i1 %24, label %UpdateDecStatus, label %LoopBody

UpdateDecStatus:                                  ; preds = %LoopEnd
  store i32 1, ptr @dec_status_0.str, align 4
  br label %Exit

Exit:                                             ; preds = %UpdateDecStatus, %Enter
  ret void
}

define private void @goron_decrypt_string_1(ptr nocapture %plain_string, ptr nocapture %data) {
Enter:
  %0 = getelementptr inbounds i8, ptr %data, i32 21
  %1 = load i32, ptr @dec_status_1.str.1, align 4
  %2 = icmp eq i32 %1, 1
  br i1 %2, label %Exit, label %LoopBody.preheader

LoopBody.preheader:                               ; preds = %Enter
  br label %LoopBody

LoopBody:                                         ; preds = %LoopBody.preheader, %LoopEnd
  %3 = phi i32 [ %23, %LoopEnd ], [ 0, %LoopBody.preheader ]
  %4 = phi i8 [ %21, %LoopEnd ], [ 0, %LoopBody.preheader ]
  %5 = getelementptr inbounds i8, ptr %0, i32 %3
  %6 = load volatile i8, ptr %5, align 1
  %7 = urem i32 %3, 21
  %8 = getelementptr inbounds i8, ptr %data, i32 %7
  %9 = load i8, ptr %8, align 1
  %10 = zext nneg i8 %9 to i32
  %11 = mul nuw nsw i32 %7, %10
  %12 = and i32 %11, 1
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %LoopBr0, label %LoopBr1

LoopBr0:                                          ; preds = %LoopBody
  %14 = add i8 %6, %4
  %15 = xor i8 %14, %9
  %16 = xor i8 %15, -1
  br label %LoopEnd

LoopBr1:                                          ; preds = %LoopBody
  %17 = sub i8 %6, %4
  %18 = xor i8 %17, %9
  %19 = sub i8 0, %18
  br label %LoopEnd

LoopEnd:                                          ; preds = %LoopBr1, %LoopBr0
  %20 = phi i8 [ %16, %LoopBr0 ], [ %19, %LoopBr1 ]
  %21 = xor i8 %20, %9
  %22 = getelementptr inbounds i8, ptr %plain_string, i32 %3
  store i8 %21, ptr %22, align 1
  %23 = add nuw nsw i32 %3, 1
  %24 = icmp eq i32 %23, 20
  br i1 %24, label %UpdateDecStatus, label %LoopBody

UpdateDecStatus:                                  ; preds = %LoopEnd
  store i32 1, ptr @dec_status_1.str.1, align 4
  br label %Exit

Exit:                                             ; preds = %UpdateDecStatus, %Enter
  ret void
}

define private void @__global_variable_initializer__ZL11struct_test(ptr nocapture %this) {
Enter:
  %0 = load i32, ptr @dec_status__ZL11struct_test, align 4
  %1 = icmp eq i32 %0, 1
  br i1 %1, label %Exit, label %InitBlock

InitBlock:                                        ; preds = %Enter
  store i32 2, ptr @dec__ZL11struct_test, align 4
  %2 = getelementptr %struct.StructTest, ptr @dec__ZL11struct_test, i32 0, i32 1
  %3 = getelementptr inbounds [140 x i8], ptr @EncryptedStringTable, i32 0, i32 26
  call void @goron_decrypt_string_0(ptr @dec0.str, ptr %3)
  store ptr @dec0.str, ptr %2, align 8
  store i32 1, ptr @dec_status__ZL11struct_test, align 4
  br label %Exit

Exit:                                             ; preds = %InitBlock, %Enter
  ret void
}

attributes #0 = { mustprogress noinline optnone ssp uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }
attributes #1 = { "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }
attributes #2 = { mustprogress noinline norecurse optnone ssp uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }

!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}

!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 15, i32 5]}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{i32 8, !"PIC Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 1}
!4 = !{i32 7, !"frame-pointer", i32 1}
!5 = !{!"clang version 19.1.3 (git@github.com:zylc369/Arkari.git 24bfb07f833b071be7f479a9c313737656a4ff37)"}
